package com.tongguan.paypos.interfaces.impl;

import com.tongguan.paypos.interfaces.CashSuper;
import com.tongguan.paypos.utils.Arith;

/**
 * Created by Joylive on 2016/12/9 .
 */

public class CashReduce extends CashSuper {

    private double moneyCondition = 0d;// 条件
    private double moneyReduce = 0d;// 减去值

    public CashReduce(double moneyCondition, double moneyReduce) {
        this.moneyCondition = moneyCondition;
        this.moneyReduce = moneyReduce;
    }

    @Override
    public double acceptCash(double money) {
        double result = money;
        if (money>=moneyCondition){
            result = Arith.sub(money,moneyReduce);
        }
        return result;
    }
}
